package main;

import java.awt.Font;
import java.awt.GridBagConstraints;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import mainSocket.Server;

public class mainframe extends JFrame {
	private JButton loginButton = new JButton("Login");
	private JButton registerButton = new JButton("Register");
	private JButton cancelButton = new JButton("Cancel");
	public Server rs;
	private JLabel userLabel = new JLabel("ID :");
	private JLabel passwdLabel = new JLabel("Password :");
	
	private JTextField userInput = new JTextField(10);
	private JPasswordField passwdInput = new JPasswordField(10);
	
	private JPanel pane = new JPanel();
	
	Font fon = new Font("Dialog",Font.PLAIN,15);
	
	void buildConstraints(GridBagConstraints gbc,int gx, int gy, int gw, int gh, int wx, int wy){
		gbc.gridx = gx;			
		gbc.gridy = gy;			
		gbc.gridwidth = gw;		
		gbc.gridheight = gh;	
		gbc.weightx = wx;		
		gbc.weighty = wy;		
	}
	
	
	private void setMyPane()
	{
		GridBagConstraints constraints = new GridBagConstraints();
		
		buildConstraints(constraints,0,0,3,1,1,1);
		pane.setLayout(null);
		userLabel.setBounds(10, 11, 29, 14);
		pane.add(userLabel);
		
		buildConstraints(constraints,3,0,3,1,1,1);
		userInput.setBounds(95, 3, 172, 26);
		userInput.setFont(fon);
		pane.add(userInput);
		
		buildConstraints(constraints,0,1,3,1,1,1);
		passwdLabel.setBounds(10, 41, 78, 14);
		pane.add(passwdLabel);
		
		buildConstraints(constraints,3,1,3,1,1,1);
		passwdInput.setBounds(95, 33, 172, 26);
		passwdInput.setFont(fon);
		pane.add(passwdInput);
		
		buildConstraints(constraints,0,2,2,1,1,1);
		loginButton.setBounds(6, 74, 71, 23);
		pane.add(loginButton);

		buildConstraints(constraints,2,2,2,1,1,1);
		cancelButton.setBounds(97, 74, 77, 23);
		pane.add(cancelButton);
		
		buildConstraints(constraints,4,2,2,1,1,1);
		registerButton.setBounds(182, 74, 90, 23);
		pane.add(registerButton);
		
		setLocation(200,80);
		setContentPane(pane);
	}

	
	public mainframe()
	{
		setTitle("Login");
		setSize(284,200);
		setMyPane();
		setVisible(true);
		setResizable(false);
	}
}
